Rewrite vhost module as virtualhost with native blasthttp#2993
Open
liquidsec wants to merge 20 commits intoblasthttp-integration-cleanfrom
Open
Rewrite vhost module as virtualhost with native blasthttp#2993liquidsec wants to merge 20 commits intoblasthttp-integration-cleanfrom
liquidsec wants to merge 20 commits intoblasthttp-integration-cleanfrom
Conversation
Brute-forces virtual hosts via HTTP Host headers and HTTPS SNI, with wildcard detection, canary consistency checks, keyword-based filtering, certificate SAN extraction, and mutation generation. Uses blasthttp resolve_ip for DNS pinning.
07dfd28 to
fecac39
Compare
Contributor
📊 Performance Benchmark Report
📈 Detailed Results (All Benchmarks)
🎯 Performance Summary! 3 regressions ⚠️
21 unchanged ✅🔍 Significant Changes (>10%)
🐍 Python Version 3.11.15 |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## blasthttp-integration-clean #2993 +/- ##
=============================================================
- Coverage 91% 91% -0%
=============================================================
Files 443 442 -1
Lines 37927 38990 +1063
=============================================================
+ Hits 34316 35129 +813
- Misses 3611 3861 +250 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Move compute_simhash off the process pool (run_in_executor_mp) onto the CPU thread pool (run_in_executor_cpu) via a new _response_similarity helper. Simhash work is short and inputs are truncated to ~3KB inside compute_simhash, so pickle/IPC overhead and broken-pool risk outweigh any parallelism win — and the recent 300s timeout on run_in_executor_mp was orphaning _test_virtualhost tasks with uncaught TimeoutError. Also remove stale 'CurlError'/'curl error' debug strings left over from the curl-helper removal.
… DictHostEvent compatibility
…lhost (vestigial name, no curl in body)
…http.mock
Rides on blasthttp 0.5.0's new httpx-style Response API
(status_code, text, content, headers as case-insensitive Headers,
cookies, raw_headers, hash, peer_ip, request, json(),
raise_for_status() raising HTTPStatusError) and the new
blasthttp.mock submodule.
Wrapper removal
---------------
Delete bbot/core/helpers/web/blast_response.py — its job (presenting
blasthttp's PyO3 Response with an httpx-shaped surface) is now done
natively by blasthttp.Response.
- WebHelper.request: returns the native blasthttp.Response instead
of wrapping. Same downstream surface.
- WebHelper.request_batch_stream: same — yields the native
blasthttp.Response.
- download() / raise_for_status: BlasthttpHTTPError → blasthttp.HTTPStatusError.
Mock migration
--------------
bbot/test/mock_blasthttp.py is now a thin wrapper over
blasthttp.mock.BlasthttpMock. The generic mock infrastructure
(handler queue with FIFO + recycle, URL/method/header/json
predicates, sync + async callbacks, batch streaming) lives upstream.
This module keeps the bbot-specific surface:
- handle_engine_request: WebHelper kwarg translation (auth tuple
→ Authorization header, cookies dict → Cookie header,
json/data body assembly, raise_error → engine-style error dict,
allow_redirects → follow_redirects).
- handle_batch_stream(real_client, ...): per-call real_client
splitting, since the WebHelper's blasthttp client isn't available
at fixture construction time.
`MockRequest`, `MockResponse`, `TimeoutException`, and the
`add_response` / `add_callback` / `should_intercept` API are all
re-exported / forwarded so the 68 module tests using them keep
working unchanged.
Module-level fixes for the new Headers API
------------------------------------------
The blasthttp.Headers class iterates as Python-dict-style keys
(httpx convention), not list-of-tuples. Three places in bbot
were unpacking headers as tuples:
- http.py: replaced manual raw_header build with
response.raw_headers (also lazy on the blasthttp side).
header_dict loop now uses .items().
- web_brute.py: location lookup uses .items().
- url_manipulation.py: subject_content now uses raw_headers
instead of stringifying the list of tuples.
diff.py compare_headers needed no special handling — blasthttp
0.5.0 registers Headers with collections.abc.MutableMapping so
DeepDiff recognizes it natively.
Pin
---
pyproject.toml: blasthttp dep bumped >=0.3.2 → >=0.5.0.
resolved_hosts can include CNAME targets (hostnames) alongside A/AAAA records, so the previous code emitted hostnames in the VIRTUAL_HOST event's 'ip' field. Filter to actual IPs at the probe-candidate sites, and use blasthttp's response.peer_ip (with host_ip fallback) for the emitted ip — that's the ground-truth IP the response came from.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Complete rewrite of the
vhostmodule (now renamed tovirtualhost). The old module was a thin wrapper around theffufGo binary for Host header fuzzing. The new module is a native Python implementation using blasthttp for all HTTP requests, with significantly expanded detection capabilities.Requires #2992 (blasthttp integration). Supersedes #2672.
What changed from the old vhost module
Architecture:
self.helpers.request()withresolve_ipfor DNS pinningcert_infofor certificate SAN extractionNew detection capabilities:
Event changes:
Renamed: vhost -> virtualhost, VHOST -> VIRTUAL_HOST, deadly flag removed